//
//  QPayPushView.m
//  QoilPublic
//
//  Created by 杨凯 on 2017/7/24.
//  Copyright © 2017年 杨凯. All rights reserved.
//

#import "QPayPushView.h"
#import "QPushOrderCell.h"
@interface QPayPushView ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UIView *backView;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIButton *payBtn;
@property (weak, nonatomic) IBOutlet UILabel *titlelabel;

@end
@implementation QPayPushView

- (void)awakeFromNib{
    [super awakeFromNib];
    [self createTableView];
}

- (void)setModel:(QPushModel *)model{
    _model = model;
    _titlelabel.text = _model.content;
    [_tableView reloadData];
}
- (void)createTableView{
    
    _backView.layer.cornerRadius = 5.0;
    _backView.layer.masksToBounds = YES;
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _payBtn.layer.cornerRadius = 5.0;
    _payBtn.layer.masksToBounds = YES;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.scrollEnabled = NO;
    
    [_tableView registerNib:[UINib nibWithNibName:@"QPushOrderCell" bundle:nil] forCellReuseIdentifier:@"QPushOrderCell"];
}

#pragma mark --- tableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    QPushOrderCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QPushOrderCell" forIndexPath:indexPath];
    cell.indexPath = indexPath;
    cell.model = _model;
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 25;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 0.01;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return 0.01;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return [[UIView alloc] init];
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    return [[UIView alloc] init];
}
- (IBAction)ChooseIndexAction:(UIButton *)sender {
    if (self.CloseBlock) {
        self.CloseBlock(sender.tag);
    }
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
